<template>
  <div>
    <!-- school -->
    <div style="padding: 0 12px 6px 12px;font-size: 14px;background-color: #FFFFFF;">毕业高中</div>
    <!-- form item -->
    <div style="display: flex;align-items: center;padding:6px 12px;background-color: #FFFFFF;">
      <div style="align-items: center;background-color: #FFFFFF;flex: 1;">
        <div style="font-size: 12px;color: #999999;">国家</div>
        <van-field
          type="text"
          placeholder="请输入"
          v-model="data.hschCty"
          style="font-size: 12px;flex: 1;background-color: #F5F5F5;padding: 3px 5px;margin-top: 5px;"
        />
      </div>
      <!-- line -->
      <div style="width: 5px;" />
      <div style="align-items: center;background-color: #FFFFFF;flex: 1;">
        <div style="font-size: 12px;color: #999999;">城市</div>
        <van-field
          type="text"
          placeholder="请输入"
          v-model="data.hschCity"
          style="font-size: 12px;flex: 1;background-color: #F5F5F5;padding: 3px 5px;margin-top: 5px;"
        />
      </div>
    </div>
    <!-- form item -->
    <div style="display: flex;align-items: center;padding:6px 12px;background-color: #FFFFFF;">
      <div style="align-items: center;background-color: #FFFFFF;flex: 1;">
        <div style="font-size: 12px;color: #999999;">学校名</div>
        <van-field
          type="text"
          placeholder="请输入"
          v-model="data.hschlName"
          style="font-size: 12px;flex: 1;background-color: #F5F5F5;padding: 3px 5px;margin-top: 5px;"
        />
      </div>
    </div>

    <!-- form item -->
    <div style="display: flex;align-items: center;padding:6px 12px;background-color: #FFFFFF;">
      <div style="align-items: center;background-color: #FFFFFF;flex: 1;">
        <div style="font-size: 12px;color: #999999;">毕业时间</div>
        <div @click="hendshow = true">
          <van-field
            type="text"
            placeholder="请输入"
            v-model="data.hschEtime"
            style="font-size: 12px;flex: 1;background-color: #F5F5F5;padding: 3px 5px;margin-top: 5px;"
          />
        </div>
      </div>
      <!-- line -->
      <div style="width: 5px;" />
      <div style="align-items: center;background-color: #FFFFFF;flex: 1;">
        <div style="font-size: 12px;color: #999999;">入学时间</div>
        <div @click="hinshow = true">
          <van-field
            type="text"
            placeholder="请输入"
            v-model="data.hschBtime"
            style="font-size: 12px;flex: 1;background-color: #F5F5F5;padding: 3px 5px;margin-top: 5px;"
          />
        </div>
      </div>
    </div>

    <!-- school -->
    <div style="padding: 0 12px 6px 12px;font-size: 14px;background-color: #FFFFFF;">大学</div>
    <!-- form item -->
    <div style="display: flex;align-items: center;padding:6px 12px;background-color: #FFFFFF;">
      <div style="align-items: center;background-color: #FFFFFF;flex: 1;">
        <div style="font-size: 12px;color: #999999;">国家</div>
        <van-field
          type="text"
          placeholder="请输入"
          v-model="data.colCty"
          style="font-size: 12px;flex: 1;background-color: #F5F5F5;padding: 3px 5px;margin-top: 5px;"
        />
      </div>
      <!-- line -->
      <div style="width: 5px;" />
      <div style="align-items: center;background-color: #FFFFFF;flex: 1;">
        <div style="font-size: 12px;color: #999999;">城市</div>
        <van-field
          type="text"
          placeholder="请输入"
          v-model="data.colAdd"
          style="font-size: 12px;flex: 1;background-color: #F5F5F5;padding: 3px 5px;margin-top: 5px;"
        />
      </div>
    </div>
    <!-- form item -->
    <div style="display: flex;align-items: center;padding:6px 12px;background-color: #FFFFFF;">
      <div style="align-items: center;background-color: #FFFFFF;flex: 1;">
        <div style="font-size: 12px;color: #999999;">学校名</div>
        <van-field
          type="text"
          placeholder="请输入"
          v-model="data.colName"
          style="font-size: 12px;flex: 1;background-color: #F5F5F5;padding: 3px 5px;margin-top: 5px;"
        />
      </div>
    </div>

    <!-- form item -->
    <div style="display: flex;align-items: center;padding:6px 12px;background-color: #FFFFFF;">
      <div style="align-items: center;background-color: #FFFFFF;flex: 1;">
        <div style="font-size: 12px;color: #999999;">毕业时间</div>
        <div @click="uendshow = true">
          <van-field
            type="text"
            placeholder="请输入"
            v-model="data.colEtime"
            style="font-size: 12px;flex: 1;background-color: #F5F5F5;padding: 3px 5px;margin-top: 5px;"
          />
        </div>
      </div>
      <!-- line -->
      <div style="width: 5px;" />
      <div style="align-items: center;background-color: #FFFFFF;flex: 1;">
        <div style="font-size: 12px;color: #999999;">入学时间</div>
        <div @click="uinshow = true">
          <van-field
            type="text"
            placeholder="请输入"
            v-model="data.colBtime"
            style="font-size: 12px;flex: 1;background-color: #F5F5F5;padding: 3px 5px;margin-top: 5px;"
          />
        </div>
      </div>
    </div>

    <!-- form item -->
    <div style="display: flex;align-items: center;padding:6px 12px;background-color: #FFFFFF;">
      <div style="align-items: center;background-color: #FFFFFF;flex: 1;">
        <div style="font-size: 12px;color: #999999;">毕业学分</div>
        <van-field
          type="text"
          placeholder="请输入"
          v-model="data.colEduCredit"
          style="font-size: 12px;flex: 1;background-color: #F5F5F5;padding: 3px 5px;margin-top: 5px;"
        />
      </div>
      <!-- line -->
      <div style="width: 5px;" />
      <div style="align-items: center;background-color: #FFFFFF;flex: 1;">
        <div style="font-size: 12px;color: #999999;">已修学分</div>
        <van-field
          type="text"
          placeholder="请输入"
          v-model="data.colCredit"
          style="font-size: 12px;flex: 1;background-color: #F5F5F5;padding: 3px 5px;margin-top: 5px;"
        />
      </div>
      <!-- line -->
      <div style="width: 5px;" />
      <div style="align-items: center;background-color: #FFFFFF;flex: 1;">
        <div style="font-size: 12px;color: #999999;">目前GPA</div>
        <van-field
          type="text"
          placeholder="请输入"
          v-model="data.colPga"
          style="font-size: 12px;flex: 1;background-color: #F5F5F5;padding: 3px 5px;margin-top: 5px;"
        />
      </div>
    </div>

    <!-- form item -->
    <div style="display: flex;align-items: center;padding:6px 12px;background-color: #FFFFFF;">
      <div style="align-items: center;background-color: #FFFFFF;flex: 1;">
        <div style="font-size: 12px;color: #999999;">就读专业</div>
        <van-field
          type="text"
          placeholder="请输入"
          v-model="data.colReadPro"
          style="font-size: 12px;flex: 1;background-color: #F5F5F5;padding: 3px 5px;margin-top: 5px;"
        />
      </div>
      <!-- line -->
      <div style="width: 5px;" />
      <div style="align-items: center;background-color: #FFFFFF;flex: 1;">
        <div style="font-size: 12px;color: #999999;">辅修专业</div>
        <van-field
          type="text"
          placeholder="请输入"
          v-model="data.colMinorPro"
          style="font-size: 12px;flex: 1;background-color: #F5F5F5;padding: 3px 5px;margin-top: 5px;"
        />
      </div>
    </div>

    <!-- form item -->
    <div style="display: flex;align-items: center;padding:6px 12px;background-color: #FFFFFF;">
      <div style="align-items: center;background-color: #FFFFFF;flex: 1;">
        <div style="font-size: 12px;color: #999999;">大学毕业学位</div>
        <van-field
          type="text"
          placeholder="请输入"
          v-model="data.colDegree"
          style="font-size: 12px;flex: 1;background-color: #F5F5F5;padding: 3px 5px;margin-top: 5px;"
        />
      </div>
    </div>

    <!-- 英语等级 -->
    <div style="padding: 0 12px 6px 12px;font-size: 14px;background-color: #FFFFFF;">英语等级</div>

    <!-- form item -->
    <div style="display: flex;align-items: center;padding:6px 12px;background-color: #FFFFFF;">
      <div style="align-items: center;background-color: #FFFFFF;flex: 1;">
        <div style="font-size: 12px;color: #999999;">英语等级</div>
        <div @click="eng_level_show=true">

          <van-field
            type="text"
            placeholder="请选择"
            v-model="data.engLevelName"
            style="font-size: 12px;flex: 1;background-color: #F5F5F5;padding: 3px 5px;margin-top: 5px;"
          />
        </div>
      </div>
      <!-- line -->
      <div style="width: 5px;" />
      <div style="align-items: center;background-color: #FFFFFF;flex: 1;">
        <div style="font-size: 12px;color: #999999;">考试分数</div>
        <van-field
          type="text"
          placeholder="请输入"
          v-model="data.engScore"
          style="font-size: 12px;flex: 1;background-color: #F5F5F5;padding: 3px 5px;margin-top: 5px;"
        />
      </div>
      <div style="width: 5px;" />
      <div style="align-items: center;background-color: #FFFFFF;flex: 1;">
        <div style="font-size: 12px;color: #999999;">考试时间</div>
        <div @click="englishshow = true">
          <van-field
            type="text"
            placeholder="请输入"
            v-model="data.engTime"
            style="font-size: 12px;flex: 1;background-color: #F5F5F5;padding: 3px 5px;margin-top: 5px;"
          />
        </div>
      </div>
    </div>
    <!-- button -->
    <div style="padding: 12px;background-color: #FFFFFF;padding-bottom: 40px;">
      <div
        @click="btnClick"
        style="border: 1px solid #007AFF;text-align: center;padding: 5px;border-radius: 4px;color: #007AFF;font-size: 14px;"
      >
        下一步
      </div>
    </div>
    <van-calendar
      :min-date="minDate"
      :show-confirm="false"
      color="#1989fa"
      v-model="hinshow"
      @confirm="hinHandle"
      position="right"
    />
    <van-calendar
      :min-date="minDate"
      :show-confirm="false"
      color="#1989fa"
      v-model="hendshow"
      @confirm="hendHandle"
      position="right"
    />
    <van-calendar
      :min-date="minDate"
      :show-confirm="false"
      color="#1989fa"
      v-model="uinshow"
      @confirm="uinHandle"
      position="right"
    />
    <van-calendar
      :min-date="minDate"
      :show-confirm="false"
      color="#1989fa"
      v-model="uendshow"
      @confirm="uendHandle"
      position="right"
    />
    <van-calendar
      :min-date="minDate"
      :show-confirm="false"
      color="#1989fa"
      v-model="englishshow"
      @confirm="englishHandle"
      position="right"
    />
    <van-action-sheet
      v-model="eng_level_show"
      description="英语等级"
      :actions="eng_levels"
      @select="eng_level_select"
      cancel-text="取消"
    />
    <van-action-sheet
      v-model="max_record_show"
      description="最高学历"
      :actions="max_records"
      @select="max_record_select"
      cancel-text="取消"
    />
  </div>
</template>

<script>
export default {
  props: ["data"],
  data() {
    return {
      minDate: new Date(2000, 0, 1),
      hinshow: false,
      hendshow: false,
      uinshow: false,
      uendshow: false,
      englishshow: false,

      eng_level_show: false,
      eng_levels: [],

      max_record_show: false,
      max_records: [],
      // data: {
      // 	"actHead": "", //	市场负责人
      // 	"addDetail": "", //	详细地址
      // 	"asdHead": "", //	ASD负责人
      // 	"backEmail": "", //	备用邮箱
      // 	"birthAdd": "", //	出身地
      // 	"chnName": "", //	渠道名
      // 	"chnSource": "", //	渠道来源
      // 	"city": "", //	城市
      // 	"colAdd": "", //	就读大学省市区
      // 	"colBtime": "", //	大学入学时间
      // 	"colCredit": "", //	大学已修学分
      // 	"colCty": "", //	就读大学国家
      // 	"colDegree": "", //	大学毕业学位
      // 	"colEduCredit": "", //	大学毕业学分
      // 	"colEtime": "", //	大学预计毕业时间
      // 	"colMinorPro": "", //	大学辅修专业
      // 	"colName": "", //	大学校名
      // 	"colPga": "", //	目前PGA
      // 	"colReadPro": "", //	大学就读专业
      // 	"country": "", //	国家
      // 	"createBy": "", //	创建人
      // 	"createTime": "", //	创建时间
      // 	"dateBirth": "", //	出生日期
      // 	"deleted": "", //	逻辑删除
      // 	"eduType": "", //	最高学历
      // 	"email": "", //	邮箱
      // 	"engLevel": "", //	英语等级
      // 	"engScore": "", //	英语等级分数
      // 	"engTime": "", //	英语等级考试时间
      // 	"followRate": "", //	跟进周期
      // 	"givenName": "", //	名
      // 	"headUrl": "", //	头像地址
      // 	"hschBtime": "", //	高中入学时间
      // 	"hschCity": "", //	高中城市
      // 	"hschCty": "", //	就读高中国家
      // 	"hschEtime": "", //	高中毕业时间
      // 	"hschlName": "", //	高中学校名
      // 	"id": "", //	ID
      // 	"interDegree": "", //	意向程度
      // 	"liveBtime": "", //	国籍所在地开始居住时间
      // 	"livePostCode": "", //	永久居住地邮编
      // 	"localPhone": "", //	国内电话
      // 	"nationality": "", //	国籍
      // 	"openid": "", //	微信openid
      // 	"osPhone": "", //	海外电话
      // 	"paperNum": "", //	证件号码
      // 	"papersType": "", //	证件类型1:身份证2:护照号
      // 	"postalCode": "", //	邮编号
      // 	"province": "", //	省份
      // 	"purpose": "", //	意向信息,以JSON字符串数组如[{’id’:’新增默认传0’,’school’:’意向学校’,’project’:’意向项目’,’course’:’意向课程,’authStatus’:’课程认证状态,’认证截图地址’:’authUrl,’failCause’:’失败原因’}]
      // 	"relaAdd": "", //	联系地址
      // 	"remark": "", //	备注
      // 	"saleHead": "", //	销售负责人
      // 	"sex": "", //	性别:1男2女
      // 	"stuName": "", //	姓名
      // 	"surname": "", //	姓
      // 	"transcriptAdd": "", //	纸质与电子成绩单地址,以JSON字符串数组如[{’id’:’新增默认传0’,’postalCode’:’邮编’,’recName’:’收件人’,’recPhone’:’收件人电话’,’recAdd’:’收件人地址’,’tranType’:’地址类型:1纸质2电子’,’email’:’邮箱’,’backEmail’:’备用邮箱’}]
      // 	"unionid": "", //	微信unionid
      // 	"updateBy": "", //	修改人
      // 	"updateTime": "", //	修改时间
      // 	"urgEmail": "", //	紧急联系人邮箱
      // 	"urgLag": "", //	紧急联系人使用语言
      // 	"urgName": "", //	紧急联系人姓名
      // 	"urgPhone": "", //	紧急联系人电话
      // 	"urgRelative": "", //	紧急联系人关系
      // 	"visaType": "", //	签证类型
      // }
    };
  },
  mounted() {
    let arr = global.dictList;
    for (const obj of arr) {
      if (obj.code == "eng_level") {
        //英语等级
        this.eng_levels.push({ value: obj.value, name: obj.label });
      }
      if (obj.code == "max_record") {
        //最高学历
        this.max_records.push({ value: obj.value, name: obj.label });
      }
    }
  },
  methods: {
    btnClick() {
      this.$emit("action");
    },
    formatDate(date) {
      let year = date.getFullYear();
      let month = date.getMonth() + 1;
      let day = date.getDate();
      return `${year}-${month}-${day}`;
    },

    hinHandle(date) {
      this.data.hschBtime = this.formatDate(date);
      this.hinshow = false;
    },
    hendHandle(date) {
      this.data.hschEtime = this.formatDate(date);
      this.hendshow = false;
    },
    uinHandle(date) {
      this.data.colBtime = this.formatDate(date);
      this.uinshow = false;
    },
    uendHandle(date) {
      this.data.colEtime = this.formatDate(date);
      this.uendshow = false;
    },
    englishHandle(date) {
      this.data.engTime = this.formatDate(date);
      this.englishshow = false;
    },
    eng_level_select(item) {
      let { value, name } = item;
      this.data.engLevel = value;
      this.data.engLevelName = name;
      this.eng_level_show = false;
    },

    max_record_select(item) {
      let { value, name } = item;
      this.data.engLevel = value;
      this.data.engLevelName = name;
      this.max_record_show = false;
    },
  },
};
</script>

<style scoped>
van-field {
  border: none;
}
</style>>